package com.tanhua.manager.job;

import com.tanhua.manager.service.AnalysisService;
import org.joda.time.DateTime;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @author 阿鹏
 * @date 2021/2/22 18:56
 */
@Component
public class AnalysisJob {

    @Autowired
    private AnalysisService analysisService;

    // 每半小时统计一次
    @Scheduled(cron = "0 0/30 * * * ?")
    public void analysis() {
        System.out.println("==开始统计，当前时间是：" + new DateTime().toString("yyyy-MM-dd HH:mm:ss") + "==");

        analysisService.analysis();

        System.out.println("==统计完成==");
    }
}
